﻿Imports System
Imports System.Collections
Imports System.Configuration
Imports System.Data
Imports System.Linq
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Xml.Linq
Imports BBDD
Imports Controladores

 _

Class cancelarAccUsuario
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

        If Session("privUser") Is Nothing Or Integer.Parse(Session("privUser").ToString()) < 1 Then
            Response.Redirect("index.aspx")
        End If


        Me.campoDNI.Text = Session("DNIUser").ToString()
        Me.campoDNI.Enabled = False


        listaPendientes.Value = "Compras:" + vbCrLf + " " + Consultas.listarCompras(1, Session("DNIUser").ToString(), 0) + vbCrLf + "Ventas:" + vbCrLf + Consultas.listarVenta(1, Session("DNIUser").ToString())
    End Sub 'Page_Load


    Protected Sub boton_cancelar_Click(ByVal sender As Object, ByVal e As EventArgs)
        If Me.ComprasOVenta.Value.ToString() = "Compras" Then
            If Consultas.cancelarOrdenCompras(campoID.Text.ToString()) Then
                controlador.CreateMessageAlert(Me, "Operacion llevada con éxito", "msg")
            End If
            controlador.CreateMessageAlert(Me, "No se ha podido cancelar la compra", "msg")
        Else
            If Consultas.cancelarOrdenVenta(campoID.Text.ToString()) Then
                controlador.CreateMessageAlert(Me, "Operacion llevada con éxito", "msg")
            End If

            controlador.CreateMessageAlert(Me, "No se ha podido cancelar la venta", "msg")
        End If
    End Sub 'boton_cancelar_Click
End Class 'cancelarAccUsuario

